import { _decorator, Component, Label, Node, ProgressBar } from 'cc';
import { Global } from '../../global';
const { ccclass, property } = _decorator;

@ccclass('setUsrInfo')
export class setUsrInfo extends Component {
    // 用户名标签
    @property(Label)
    usrName: Label = null;

    // vip标签
    @property(Label)
    vipNum: Label = null;

    // 等级标签
    @property(Label)
    lvlNum: Label = null;

    // 金币标签
    @property(Label)
    coinsNum: Label = null;

    // 经验进度条
    @property(ProgressBar)
    expBar: ProgressBar = null;

    protected onLoad(): void {
        this.setUsrInfo();
    }

    setUsrInfo() {
        const user = Global.UsrMg;
        this.usrName.string = user.username;
        this.vipNum.string = user.vip + '';
        this.lvlNum.string = user.lv + '';
        this.coinsNum.string = user.coins + '';
        this.expBar.progress = user.exp / user.expAll;
    }
}


